﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DimensionData.Data2
{
    /// <summary>
    /// 维度表
    /// </summary>
    public class DTable
    {
        public string Code { get; set; }
        public string Name { get; set; }

        public DTable(string code, string name)
        {
            this.Code = code;
            this.Name = name;
        }

        public DCTable Combine(DTable table)
        {
            DCTable dcTable = new DCTable();
            dcTable.Tables.Add(this);
            dcTable.Tables.Add(table);

            dcTable.RelationChain.Append(new Relations.DDRelation(this, table));
            return dcTable;
        }

        public DCTable Combine()
        {
            DCTable dcTable = new DCTable();
            dcTable.Tables.Add(this);
            return dcTable;
        }

        public DData GetData(DContext context)
        {
            DData data = DMockData.GetData(this);
            data.Table = this;
            return data;
        }
    }
}
